<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>用户编辑--博客后台管理</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">
	<link rel="stylesheet" href="../../layui/css/layui.css" media="all" />
	<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
	<script type="text/javascript" src="../../js/template-web.js"></script>
	<script type="text/javascript" src="../../layui/layui.js"></script>
	<script type="text/javascript" src="clientUpdate.js"></script>
</head>
<body class="childrenBody"></body>
<script id="updateForm" type="text/html">
	<form class="layui-form">
		<input type="hidden" name="id" value="{{id}}" >
		<div class="layui-form-item">
			<label class="layui-form-label">用户昵称</label>
			<div class="layui-input-block">
				<input type="text"  name="nickname"  value="{{nickname}}" class="layui-input" lay-verify="required" lay-verify="required" placeholder="请输入您的昵称">
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">启用状态</label>
			<div class="layui-input-block">
				<input type="checkbox" name="status"  value="{{status}}" lay-skin="switch" lay-text="启用|禁用" {{if status=="0"}} checked="checked" {{/if}} >
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">权限等级</label>
			<div class="layui-input-block">
				<select name="level" lay-verify="required">
				<option value="0" {{if level=="0"}}selected {{/if}}>普通管理员</option>
				<option value="9" {{if level=="9"}}selected {{/if}}>超级管理员</option>
				</select>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<button class="layui-btn" lay-submit="" lay-filter="update">立即提交</button>
				<button type="reset" class="layui-btn layui-btn-primary">重置</button>
			</div>
		</div>
	</form>
</script>

<script>
	$(function(){
		//获取页面的id
		var id = location.href.substr(location.href.lastIndexOf("#")+1);
		$.ajax({
			url:"/admin/selectOne.do",
			type:"get",
			data:{"id":id},
			success:function(data){
				var tempHtml = template("updateForm",data);
				$(".childrenBody").html(tempHtml);
				layui.config({
					base : "js/"
				}).use(['form'],function(){
					var form = layui.form();
					form.render();
				})
			},
			error:function(xhr,errorText,errorType){
				if(xhr.status==403){
					layui.config({
						base : "js/"
					}).use(['layer'],function(){
						var layer = parent.layer === undefined ? layui.layer : parent.layer;
						var  authorInfo = layer.msg('对不起，你没有该权限',{icon: 4,time:false,shade:0.8});
						setTimeout(function(){
							layer.close(authorInfo);
							layer.closeAll("iframe");
							/*layer.close(sessionStorage.getItem("layerId"));
							sessionStorage.removeItem("layerId");*/
						},3000);
					})
				}
			}
		})
	})
</script>

</html>